UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhtV3IfFTtyknSGg8DPyDcVPsv+nN2c9itUozVACT6o=' 
WHERE 
  key_id = 'ca886c618b5cc2ee696d07a1cf7f6e7c8bbed63fb01f460d32c35e94fff3d719' 
  AND (
    token = 'UhtV3IfFTtyknSGg8DPyDcVPsv+nN2c9itUozVACT6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028