UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7rwqIejqT7F/S8zDPLcEIZil8c9NUnpUud3qjmZbpkM=' 
WHERE 
  key_id = '6ec2d7b83ff81784065098d6c3a6ed56c0f72c4e016fc5e6c7a3d1b467e18e9c' 
  AND (
    token = '7rwqIejqT7F/S8zDPLcEIZil8c9NUnpUud3qjmZbpkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047