UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cek3eqt4H3sIBDsnPUrivTofIcpKG8rL+EI50eGwJUM=' 
WHERE 
  key_id = '11c19fa57903f5089555eed7206b1e8995fe34239ab919724ea7b72483f8cbe4' 
  AND (
    token = 'Cek3eqt4H3sIBDsnPUrivTofIcpKG8rL+EI50eGwJUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038