UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm0fgzS+1KHorLItNkhFFeUkWbzjddl+W7TQFUBhF5y4=' 
WHERE 
  key_id = '406bd571984bea9d845a93dd5d4b95b95e7722ebedcad1dd240db04633a7e988' 
  AND (
    token = 'm0fgzS+1KHorLItNkhFFeUkWbzjddl+W7TQFUBhF5y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046