UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wqIaBXznTboRx1VMcHqMQpAYzmJYgaAgbwq2AvxOMew=' 
WHERE 
  key_id = '678ccb9a0071ae643353f4cf64d15f859f38ae15793b14b18e89f356074b56d2' 
  AND (
    token = 'wqIaBXznTboRx1VMcHqMQpAYzmJYgaAgbwq2AvxOMew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049