UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qt+oEG19ghj1HjdqKV9LnY3fF7nGCECWAgy6ciQgqd8=' 
WHERE 
  key_id = '297d4aec4d7c518cc7d3fb3ab1e5bd0604017b3ee2bf0b9b8dcf6c86ad4974bc' 
  AND (
    token = 'Qt+oEG19ghj1HjdqKV9LnY3fF7nGCECWAgy6ciQgqd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024