UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xaHsmb+r17eSrvEAHk/pWX/54cRPqyKMCdVYNPVvEAU=' 
WHERE 
  key_id = '3cd7365dba0705b066dfe3e138c82a1f1773a7ec49db615c7b8d2b6d5179fb19' 
  AND (
    token = 'xaHsmb+r17eSrvEAHk/pWX/54cRPqyKMCdVYNPVvEAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032