UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9zdKcvHRC48OAPXZETovUygmFjdBM4HJ3GOEKmtuNS8=' 
WHERE 
  key_id = 'ce0ab9f6bf163bfa2f7a1f534155edd01f462d377433ded0a51430584da014b7' 
  AND (
    token = '9zdKcvHRC48OAPXZETovUygmFjdBM4HJ3GOEKmtuNS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044