UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fT05fxJ2SX3GjOcgOahGc4sxmtkEd78oBsaUI9Vzei0=' 
WHERE 
  key_id = '07b14f0612f1b7ec26c8ac6312044e48932712989620fd1044440475aaeb19cf' 
  AND (
    token = 'fT05fxJ2SX3GjOcgOahGc4sxmtkEd78oBsaUI9Vzei0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039