UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uhg0S2uxYWT8Xz2k3WmyzCFuKviJvbdZRkt+GUoVVk0=' 
WHERE 
  key_id = 'ce717d7f0d98ca9a11f95cefa7278cabb6f4f72ba7b8203de697914e51053564' 
  AND (
    token = 'uhg0S2uxYWT8Xz2k3WmyzCFuKviJvbdZRkt+GUoVVk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026