UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NqZCusJt5QgKgGpATa116caNWw5P1q98wJlFeuwZy9Q=' 
WHERE 
  key_id = 'b68709cef7c23a0ef846254262f2f4a5b2d8c0e24b435669de298d36b6aecc5e' 
  AND (
    token = 'NqZCusJt5QgKgGpATa116caNWw5P1q98wJlFeuwZy9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056