UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jcs5aaAdiKAq+2v8JRvnYT4GVcG5MS8JjA8cfdiQHh8=' 
WHERE 
  key_id = 'f8d6238d5a4fc8afc6d1dfd30bce7697fef46e61b870befc1fa58185c6b99517' 
  AND (
    token = 'Jcs5aaAdiKAq+2v8JRvnYT4GVcG5MS8JjA8cfdiQHh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028