UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5nSsIZ8wh0eiCpEtANKVqVjJ3meSZ8yjMyISLoQ7k8=' 
WHERE 
  key_id = '378026c0adfa8a956d787410a7c9d205466714ae509526fedd4d42e32175e9b6' 
  AND (
    token = 'G5nSsIZ8wh0eiCpEtANKVqVjJ3meSZ8yjMyISLoQ7k8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040