UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JdTIFpM6uNOktDxf5X5ZiYgZmHbhI2HFx5W2ypVM5zI=' 
WHERE 
  key_id = '08c8cbc85f93eb0fd38ff0421645c678a3058932a3560143e7716f09d715f894' 
  AND (
    token = 'JdTIFpM6uNOktDxf5X5ZiYgZmHbhI2HFx5W2ypVM5zI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035