UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6ys92aroFlB1hC30vAOhpUgAZ2kt53Tl0FnEmcITsaw=' 
WHERE 
  key_id = 'd604778467329780cd4416334c6040b5785938e4ddbfb0625db7226342824f0b' 
  AND (
    token = '6ys92aroFlB1hC30vAOhpUgAZ2kt53Tl0FnEmcITsaw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013