UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f9lKu6tVHttDpetnH/3AEzBC7eM/+UepswTNIQ1rosk=' 
WHERE 
  key_id = '042091d06338c3755ad56697d1149309e2d9a378be106d65b7d83c5f8e35f7b9' 
  AND (
    token = 'f9lKu6tVHttDpetnH/3AEzBC7eM/+UepswTNIQ1rosk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032