UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'onWWgi15t91anEv7hLKDqRL4Rkmwig1yFtv7tef4N2s=' 
WHERE 
  key_id = '29e0320cb30256bb14bfa89d290b5fc3c5d1b0ff78fa12cc04cddcad145a49bc' 
  AND (
    token = 'onWWgi15t91anEv7hLKDqRL4Rkmwig1yFtv7tef4N2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012