UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tiy2mClc3T9PB++j8BVAMRjFD06oaEKkjL3Kubg7Lls=' 
WHERE 
  key_id = '837980eacd69a1a437913c7fab38adfc91d014db00fa1b706ed12a3656a35940' 
  AND (
    token = 'Tiy2mClc3T9PB++j8BVAMRjFD06oaEKkjL3Kubg7Lls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015