UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fPu4jfqo6ERIQQ8jwCMEBqqiNtb3fCTJiZj6CVuqH78=' 
WHERE 
  key_id = 'd713d591676f6349f009b330323289af3dfd26f9b84789955922b8a8dc2d0d39' 
  AND (
    token = 'fPu4jfqo6ERIQQ8jwCMEBqqiNtb3fCTJiZj6CVuqH78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023