UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKWKq+9dJt8zczbuhwM5rd7LOYkoiLWxtJ+khquDgs8=' 
WHERE 
  key_id = '842bbab936d2eb3542fa33843dfdc075070b490aa618bd4f73daff5e8f80848e' 
  AND (
    token = 'pKWKq+9dJt8zczbuhwM5rd7LOYkoiLWxtJ+khquDgs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029