UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pL2KPM+srDjp288bwONkGvjPKiwUR2496ku6Ovaeekw=' 
WHERE 
  key_id = '698f78882870f2d4b51ad194b68450c364b5aa45c47fbf39534ec12337fea7b1' 
  AND (
    token = 'pL2KPM+srDjp288bwONkGvjPKiwUR2496ku6Ovaeekw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026