UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZppPejKGKJKB/921E7nvr5tySvsTaED10McqourmQRw=' 
WHERE 
  key_id = 'b63862308aa148f4e297e0d5a07b03f74b80bce7975b49f77009a791cded5d0c' 
  AND (
    token = 'ZppPejKGKJKB/921E7nvr5tySvsTaED10McqourmQRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025