UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0nEgCzcFa+wNJZJdZqcp2Tq8kXKGh2THjmk1Swue9k=' 
WHERE 
  key_id = '69954ef60e614e5bf336c3e56aab92e833edbf49ac28ab204391a03711cc76b5' 
  AND (
    token = 'q0nEgCzcFa+wNJZJdZqcp2Tq8kXKGh2THjmk1Swue9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021