UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RpvHelJdEQM0LPs0ZEWrvy+Kcj5PGraxNdT0uMbIuMw=' 
WHERE 
  key_id = '95d7e2bc526970eca01460a50c745ad17b1b60dc44b1353486ec236dd2c06130' 
  AND (
    token = 'RpvHelJdEQM0LPs0ZEWrvy+Kcj5PGraxNdT0uMbIuMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026