UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8Dbn/kaCAPQQrSaxUMQGL164v87gc43mdC0uorW9Co=' 
WHERE 
  key_id = '9207d6ccfa99cb6be5b564600225ecea265f535bbbf6dead511b288296ff63c6' 
  AND (
    token = 'Y8Dbn/kaCAPQQrSaxUMQGL164v87gc43mdC0uorW9Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016