UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xdwSD7qa9Hy0/bGlkiPx5c9xIWUpGfT/ffGIfYNwrFI=' 
WHERE 
  key_id = 'b5c858c6a2d3eb5fa977389355d87a8a75431153b099fd56284e06a5e754c767' 
  AND (
    token = 'xdwSD7qa9Hy0/bGlkiPx5c9xIWUpGfT/ffGIfYNwrFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021