UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XjmwEJHuOYdM0ZHa8s/R0OSzL9w5crXwBAdgTv8hhsE=' 
WHERE 
  key_id = 'ad36464b2ead9d72e1d34f214f4151956cfd41a354c709376612ebdeacc9841e' 
  AND (
    token = 'XjmwEJHuOYdM0ZHa8s/R0OSzL9w5crXwBAdgTv8hhsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035