UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't/7fdx2azLALeuGHPRM5dV7Dode6kLJS1agmfMXdSzk=' 
WHERE 
  key_id = '9b3045161dd6aed4de8769f3d16357f0441e1153fa575464e642623838e72a98' 
  AND (
    token = 't/7fdx2azLALeuGHPRM5dV7Dode6kLJS1agmfMXdSzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043