UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n15rtdGKXCTlr+sFLHuG9vq5hJTR9F74V+MEo0jAMAE=' 
WHERE 
  key_id = 'f0edd10e1b66a39e54098ad17dc2af413e8424f372f87da26660ded8c7bde67e' 
  AND (
    token = 'n15rtdGKXCTlr+sFLHuG9vq5hJTR9F74V+MEo0jAMAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028